package com.xiaoxu.intranetweb.mybatisplusSzappdb.controller.truck;

import cn.dev33.satoken.stp.StpUtil;
import com.xiaoxu.intranetweb.mybatisplusSzappdb.business.truck.TruckAdvancedBu;
import com.xiaoxu.intranetweb.mybatisplusSzappdb.dao.UserInfoDao;
import com.xiaoxu.intranetweb.util.PermissionCheck;
import com.xiaoxu.intranetweb.util.SzResult;
import com.xiaoxu.intranetweb.util.WebFunctionUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

@RestController
@RequestMapping("/TruckAdvance")
public class TruckAdvanceController {

    @Autowired
    private TruckAdvancedBu truckAdvanceBu;
    @Autowired
    private UserInfoDao userInfoDao;
    @Autowired
    private WebFunctionUtil webFunctionUtil;

    //车辆的高级操作
    @GetMapping("/truckAdvance")
    @PermissionCheck("truck_truckAdvance")
    public SzResult truckAdvance(@RequestParam String id,
                                 @RequestParam(value = "identifyQueueStatus", required = false) Integer identifyQueueStatus,
                                 @RequestParam(value = "identifyLoadStatus", required = false) Integer identifyLoadStatus,
                                 @RequestParam(value = "approveStatus", required = false) Integer approveStatus,
                                 @RequestParam(value = "approveQueueStatus", required = false) Integer approveQueueStatus,
                                 @RequestParam(value = "delayTimeStatus", required = false) Integer delayTimeStatus,
                                 @RequestParam(value = "trucksAgainMinTm", required = false) String trucksAgainMinTm,
                                 HttpServletRequest request) throws Exception {
        String token = request.getHeader("Authorization");
        String plantId = request.getHeader("Plant-Id");
        return truckAdvanceBu.TruckAdvanced(id, identifyQueueStatus, identifyLoadStatus, approveStatus, approveQueueStatus, delayTimeStatus, trucksAgainMinTm, token, plantId);
    }
}
